home *** CD-ROM | disk | FTP | other *** search
/ Info-Mac 4 / Info_Mac IV CD-ROM (Pacific HiTech Inc.)(August 1994).iso / Development / Source / Incognito / cdev / ChooserDialog.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-02-06  |  2.4 KB  |  106 lines  |  [TEXT/MPS ]

  1. #ifndef __CHOOSERDIALOG__
  2. #define __CHOOSERDIALOG__
  3.  
  4. #pragma once
  5.  
  6. #ifndef __APPLETALK__
  7. #include <AppleTalk.h>
  8. #endif
  9.  
  10. #ifndef __DIALOGS__
  11. #include <Dialogs.h>
  12. #endif
  13.  
  14. #ifndef __CLISTMANAGER__
  15. #include "CListManager.h"
  16. #endif
  17.  
  18. #define        kATPTimeOutVal            3                            // re-try ATP SendRequest every 3 seconds 
  19. #define        kATPRetryCount            5                            // for five times 
  20. #define        kZonesSize                578                            // size of buffer for zone names 
  21. #define        kGetMyZoneCall            0x07000000                    // GetMyZone indicator 
  22. #define        kGetZoneListCall        0x08000000                    // GetZoneList indicator 
  23. #define        kZIPSocket                6                            // the Zone Information Protocol socket 
  24. #define        kMoreZones                0xFF000000                     // mask to see if more zones to come 
  25. #define        kZoneCount                0x0000FFFF                     // mask to count zones in buffer 
  26.  
  27. #define        kTupleSize    104
  28. #define        kMaxTuples    1
  29.  
  30. enum
  31. {
  32.     kAddButton = 1,
  33.     kDoneButton,
  34.     kZoneList,
  35.     kDeviceList,
  36.     kRemoveButton,
  37.     kZoneText,
  38.     kDeviceText,
  39.     kChosenList,
  40.     kDeviceTypeText,
  41.     kChosenText
  42. };
  43.  
  44. #ifdef __cplusplus
  45. extern "C"
  46. {
  47. #endif
  48. void EraseBigFrame(DialogPtr theDialog, short item);
  49. void DrawSmallFrame(DialogPtr theDialog, short item);
  50. void DrawBigFrame(DialogPtr theDialog, short item);
  51. #ifdef __cplusplus
  52. }
  53. #endif
  54.  
  55. class CChooserDialog : public SingleObject
  56. {
  57.     public:
  58.     
  59.                 CChooserDialog();
  60.                 ~CChooserDialog();
  61.         void    Run();
  62.         void    Initialize(short resID);
  63.         void    SetChosenList(CListManager *fOriginalList);
  64.  
  65.     protected:
  66.         
  67.         short    GetActive(void) {return fActiveItem;}
  68.         short    DoTabCycle(short theDirection);
  69.         void    DoUpdate(EventRecord *theEvent);
  70.         void    DoNull(void);
  71.         void    DoKey(EventRecord *theEvent);
  72.         void    AdjustButtons(void);
  73.         void DoZoneHit();
  74.         void DoChosenHit();
  75.         void DoDeviceHit();
  76.         void    DoTyping(EventRecord *theEvent, char key);
  77.         void    InitZoneList();
  78.         void    ResetLastKey(long when);
  79.         OSErr    DoBuildZoneList(void);
  80.         OSErr    HiliteUserZone(void);
  81.         OSErr    OldStyleGetMyZone(StringPtr str);
  82.         void    ChangeActive(short theItem);
  83.         void    InitDeviceList();
  84.  
  85.         static pascal Boolean EventFilterProc(DialogPtr theDialog, EventRecord *theEvent, short *itemHit);
  86.     void DoAddButton(void);
  87.  
  88.     void DoRemoveButton(void);
  89.  
  90.  
  91.  
  92.         Ptr                fLookupBuffer;
  93.         char            fBuffer[36];
  94.         long            fLastCharTime;    // time of last keydown
  95.         Str32            fCharString;    // string that holds characters that were typed 4 sel
  96.         short            fActiveItem;
  97.         short            fNumGotten;
  98.         DialogPtr        fTheDialog;
  99.         EventRecord        fTheEvent;
  100.         CListManager    *fZoneList, *fDeviceList, *fChosenList, *fOriginalList;
  101.         MPPParamBlock    fLookupParam;
  102. };
  103.  
  104.  
  105. #endif
  106.